home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Stolen Data 3
/
Stolen Data 3.adf
/
SOURCE
/
Scroller2.bak
< prev
next >
Wrap
Text File
|
1988-12-31
|
8KB
|
326 lines
*****************************************************************************
; STOLEN DATA Issue #3
; ~~~~~~~~~~~~~~~~~~~~
; Double buffered base relief scroller
;
; Copyright ANARCHY 1990
;
; Written on 3.6.90 by Kreator of ANARCHY
;
; General notes - At all times (unless specified) a6 points to the custom
; chip registers ($dff000) and a5 points to the list of variables.This allows
; indirect addressing modes to be used, which are much faster than absolute
; addressing and consume less memory. If these registers are needed in the
; course of a routine simply stick them on the stack, and pop them back off
; later.
*****************************************************************************
Incdir DF1:
Include Source/NewCustomReg ; Custom register label equates
Section Scroller,Code_c ; Assemble into chip mem if > ½ meg
Trap_vec0 = $80
Execbase = $4
Oldopen = -$198
Move.l #Start,$80.w ; Trap vector 0
Trap #0 ; Execute trap 0 to give full control of the
Rts ; 68000, needs an RTE to return.
Start
Bsr Killsys ; Disable the operating system
Bsr Setup ; Setup the demo
Bsr Main ; Now run the main demo routines
Bsr Sysreturn ; Return the system to its original state
Moveq.l #0,d0 ; No errors !! A number of people neglect to
; do this, and that causes batch files (such
; as the startup sequence) to bomb out.
Rte ; Return from exception ie. to the instruction after
; the TRAP #0 call.
*****************************************************************************
;Killsys - Disable operating system and interrupts
*****************************************************************************
Killsys
Move.l $4.w,a6 ; Execbase vector
Lea Gfxname(pc),a1 ; Pointer to "graphics.library" into a1
Jsr Oldopen(a6) ; Open this library
Lea Variables,a5 ; Get a pointer to the variable space
Lea $dff000,a6 ; Pointer to custom chips
Move.l d0,a0 ; Address of the graphics library
Move.l 38(a0),Sys_copl(a5) ; Remember the System copperlist
Move Intenar(a6),Int_set(a5) ; System interrupts
Move #$7fff,Intena(a6) ; Now switch off all interrupts
Move.l $6c.w,Vbl_vec(a5) ; System vertical blanking int.
Move Dmaconr(a6),Dma_set(a5) ; System DMA
Move #$7fff,Dmacon(a6) ; Clear all DMA
Move #$87c0,Dmacon(a6) ; Now set the required DMA channels
Rts
Gfxname Dc.b "graphics.library",0
Even
*****************************************************************************
;Sysreturn - Re-enable operating system and interrupts
*****************************************************************************
Sysreturn
Move #$7fff,Intena(a6) ; Clear all interrupts
Move.l Vbl_vec(a5),$6c.w ; Restore VBL interrupt
Move Int_set(a5),d0
Or #$c000,d0
Move d0,Intena(a6) ; Restore system interrupts
Move #$7fff,Dmacon(a6)
Move Dma_set(a5),d0
Or #$8200,d0
Move d0,Dmacon(a6) ; Restore system DMA
Move.l Sys_copl(a5),Cop1lch(a6) ; Restore system copperlist
Clr Copjmp1(a6)
Rts
*****************************************************************************
;Setup - Setup the menu system
*****************************************************************************
Setup
;-- Remove the sprite data (prevents sprite streaks down the screen)
Lea Spr0data(a6),a0
Moveq #7,d0
Clop
Clr.l (a0)
Addq.l #8,a0
Dbf d0,Clop
;-- Clear the scroll area
Lea Screen1,a0
Move #$bff,d0
Clear_scroll
Clr.l (a0)+
Dbf d0,Clear_scroll
;-- Initialise some variables
Move.l #Screen1+80,Current_bank(a5) ; The two double buffered
Move.l #Screen2+80,Other_bank(a5) ; scroll areas
Move.l #Scrolltext,Text_pt(a5) ; Initialise the scrolltext
Move #5,Speed(a5) ; Set the scroll speed
Move.l #Clstart,Cop1lch(a6) ; Init. our own copperlist
Clr Copjmp1(a6)
Rts
*****************************************************************************
; Main - Central demo calling routine + mouse button check
*****************************************************************************
Main
Move.l Vposr(a6),d0
And.l #$1ff00,d0
Cmp.l #$00100,d0 ; Wait for vertical position 1
Bne.s Main
Bsr Scroller ; Jump to the scroll routine
Move #$200,d0 ; Small delay loop, this is needed because
.Loop ; in general the scroll routine uses less
Dbf d0,.Loop ; than 1 raster line.As soon as more routines
; are added this is no longer required.
Btst #6,$bfe001 ; Check the left mouse button
Bne.s Main
Rts
*****************************************************************************
; Scroller -
*****************************************************************************
Scroller
Move Scroll_pt(a5),d0
Add Speed(a5),d0
Cmp #256,d0
Blt.s No_bank_change
Move.l Current_bank(a5),a0
Move.l Other_bank(a5),Current_bank(a5)
Move.l a0,Other_bank(a5)
Sub #256,d0
Clr Mode(a5)
No_bank_change
Move d0,Scroll_pt(a5)
Move d0,d1
Move d0,d2
Addq #1,d2
Move d2,d3
Lsr #4,d0
Add d0,d0
Lsr #4,d2
Add d2,d2
Add Current_bank+2(a5),d0
Add Current_bank+2(a5),d2
Sub #80,d0
Lea Scroll_planes+2(pc),a0
Move d0,(a0)
Move d2,8(a0)
And #$0f,d1
Eor #$0f,d1
And #$0f,d3
Eor #$0f,d3
Lsl #4,d3
Or d3,d1
Move d1,Scroll+2
Cmp #20,Mode(a5)
Beq No_blitting
Cmp #12,Mode(a5)
Blt Char_scroll
New_chars
Moveq #0,d0
Move Mode(a5),d2
Lsl #2,d2
Move.l Other_bank(a5),a2
Lea (a2,d2),a2
Bsr Read_char
Addq.l #2,a2
Bsr Read_char
Bra Blit_exit
Read_char
Move.l Text_pt(a5),a0
New_char
Move.b (a0)+,d0
Bne.s Not_a_null
Move.l #Scrolltext,a0
Bra.s New_char
Not_a_null
Cmp #$20,d0
Bge.s Not_control
Moveq #$20,d0
Not_control
Cmp #$5c,d0
Beq Control_char
Cmp #$5b,d0
Blt.s Not_lower_case
Sub #$20,d0
Not_lower_case
Move.l a0,Text_pt(a5)
Sub #$20,d0
Add d0,d0
Lea Charpos(pc),a0
Move (a0,d0),d1
Lea Font(pc),a1
Lea (a1,d1),a1
Move.l #-1,Bltafwm(a6)
Move.l a2,Bltdpth(a6)
Move.l a1,Bltapth(a6)
Move.l #$09f00000,Bltcon0(a6)
Move.l #$0026004e,Bltamod(a6)
Move #64*16+1,Bltsize(a6)
Bra Blit_wait
Char_scroll
Move Mode(a5),d0
Lsl #2,d0
Move.l Other_bank(a5),a0
Move.l Current_bank(a5),a1
Lea (a0,d0),a0
Lea 32(a1,d0),a1
Move.l #-1,Bltafwm(a6)
Move.l a0,Bltdpth(a6)
Move.l a1,Bltapth(a6)
Move.l #$09f00000,Bltcon0(a6)
Move.l #$004c004c,Bltamod(a6)
Move #64*16+2,Bltsize(a6)
Bsr Blit_wait
Blit_exit
Addq #1,Mode(a5)
No_blitting
Rts
Control_char
Move.b (a0)+,d0
Sub #$40,d0
Move d0,Speed(a5)
Move #$20,d0
Bra Not_lower_case
Blit_wait
Btst #14,Dmaconr(a6)
Bne.s Blit_wait
Rts
*****************************************************************************
; Copperlist1 for the menu selector screen
*****************************************************************************
Clstart
Wait 0,20 ; Give the processor time to update the cl.
Mov $9a64,Diwstrt
Mov $abd1,Diwstop
Mov $0028,Ddfstrt ; Horizontal scrolling overscan screen
Mov $00d8,Ddfstop ; ie. 368 pixels wide
Mov 0,Color00
Mov $666,Color01
Mov $fff,Color02
Mov $aaa,Color03
Mov 34,Bpl1mod
Mov 34,Bpl2mod
Scroll
Mov 0,Bplcon1
Mov 0,Bplcon2
Scroll_planes
Mov $00,Bpl1ptl
Mov 7,Bpl1pth
Mov $00,Bpl2ptl
Mov 7,Bpl2pth
Mov $2200,Bplcon0
Wait $fe,$ff
*****************************************************************************
; Binaries
*****************************************************************************
Font
Incbin Binary/Bubble.font
Charpos Dc.w $0000,$0002,$0004,$0006,$0008,$000a,$000c,$000e ; !"#$%&'
Dc.w $0010,$0012,$0014,$0016,$0018,$001a,$001c,$001e ;()*+,-./
Dc.w $0020,$0022,$0024,$0026,$0280,$0282,$0284,$0286 ;01234567
Dc.w $0288,$028a,$028c,$028e,$0290,$0292,$0294,$0296 ;89:;<=>?
Dc.w $0298,$029a,$029c,$029e,$02a0,$02a2,$02a4,$02a6 ;@ADCDEFG
Dc.w $0500,$0502,$0504,$0506,$0508,$050a,$050c,$050e ;HIJKLMNO
Dc.w $0510,$0512,$0514,$0516,$0518,$051a,$051c,$051e ;PQRSTUVW
Dc.w $0520,$0522,$0524,$0526 ;XYZ[\]^_
Scrolltext
Dc.b "insert your own scrolltext here !!!"
Dc.b " this scroller was written for "
Dc.b "STOLEN DATA, copyright ANARCHY 1990"
Dc.b " ",0
Even
*****************************************************************************
; Variables
*****************************************************************************
Rsreset
Int_set Rs.w 1
Dma_set Rs.w 1
Sys_copl Rs.l 1
Vbl_vec Rs.l 1
Scroll_pt Rs.w 1
Mode Rs.w 1
Current_bank Rs.l 1
Other_bank Rs.l 1
Text_pt Rs.l 1
Speed Rs.w 1
Varisize Rs.b 0
Variables Dcb.b Varisize ; Reserve space for the variables
Rsset $70000
Screen1 Rs.b 18*80
Screen2 Rs.b 18*80